﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IO
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建Mysolo文件夹
            DirectoryInfo info = new DirectoryInfo("D:\\Mysolo");
            info.Create();
            Console.WriteLine("文件夹Mysolo - " + info.Parent.FullName);
            
            //判断是否存在Mysolo
            bool File = Directory.Exists("D:\\Mysole");
            if(File)
            {
                Console.WriteLine("分区中存在Mysole文件夹 正在删除....");
                //删除存在文件夹
                Directory.Delete("D:\\Mysole", true);
                Console.WriteLine("删除完毕，请安任意键结束");
                Console.ReadKey();
            }
            else
            {
                //新建Mysole文件夹
                Directory.CreateDirectory("D:\\Mysole");
                //创建text.doc
                FileInfo fileInfo = new FileInfo("D:\\Mysole\\text.doc");
                //插入内容
                string path = @"D:\\Mysole\\text.doc";
                StreamWriter streamWriter = new StreamWriter(path);
                streamWriter.Write("成为专才之前，先成为通才\n最大的伤害，是否认伤害的存在\n最大的问题，是回避问题的存在");
                //刷新缓存
                streamWriter.Flush();
                //关闭流
                streamWriter.Close();
            }

        }
    }
}
